-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix: fix test.scoped inheritance #7814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fix test.scoped inheritance #7814
Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
| const context = { ...this } | ||
| if (scopedFixtures) { | ||
| this.fixtures = mergeScopedFixtures( | ||
| this.fixtures || [], | ||
| context.fixtures = mergeScopedFixtures( | ||
| context.fixtures || [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is shared between all extendedTest instance as per fn.apply(context, args) in
vitest/packages/runner/src/utils/chain.ts
Lines 11 to 18 in dee7ce9
| export function createChainable<T extends string, Args extends any[], R = any>( | |
| keys: T[], | |
| fn: (this: Record<T, any>, ...args: Args) => R, | |
| ): ChainableFunction<T, (...args: Args) => R> { | |
| function create(context: Record<T, any>) { | |
| const chain = function (this: any, ...args: Args) { | |
| return fn.apply(context, args) | |
| } |
This was causing extendedTest to track fixtures in a stateful way instead of suite level inheritance. Existing tests were probably relying on that behavior and making inheritance look working.
Now I removed this stateful mutation logic, so proper suite level fixture inheritance is required and that's done via createSuiteCollector's parentCollectorFixtures.
v3.1.2 🐞 Bug Fixes Add global chai variable in vitest/globals (fix: #7474) - by @Jay-Karia in vitest-dev/vitest#7771 and vitest-dev/vitest#7474 (d9297) Prevent modifying test.exclude when same object passed in coverage.exclude - by @AriPerkkio in vitest-dev/vitest#7774 (c3751) Fix already hoisted mock - by @hi-ogawa in vitest-dev/vitest#7815 (773b1) Fix test.scoped inheritance - by @hi-ogawa in vitest-dev/vitest#7814 (db6c3) Remove pointer-events-none after resizing the left panel - by @alexprudhomme in vitest-dev/vitest#7811 (a7e77) Default to run mode when stdin is not a TTY - by @kentonv, @hi-ogawa and @sheremet-va in vitest-dev/vitest#7673 (6358f) Use happy-dom/jsdom types for envionmentOptions - by @hi-ogawa in vitest-dev/vitest#7795 (67430) browser: Fix transform error before browser server initialization - by @hi-ogawa in vitest-dev/vitest#7783 (5f762) Fix mocking from outside of root - by @hi-ogawa in vitest-dev/vitest#7789 (03f55) Scale iframe for non ui case - by @hi-ogawa in vitest-dev/vitest#6512 (c3374) coverage: await profiler calls - by @AriPerkkio in vitest-dev/vitest#7763 (795a6) Expose profiling timers - by @AriPerkkio in vitest-dev/vitest#7820 (5652b) deps: Update all non-major dependencies - in vitest-dev/vitest#7765 (7c3df) Update all non-major dependencies - in vitest-dev/vitest#7831 (15701) runner: Correctly call test hooks and teardown functions - by @sheremet-va in vitest-dev/vitest#7775 (3c00c) Show stacktrace on test timeout error - by @hi-ogawa in vitest-dev/vitest#7799 (df33b) ui: Load panel sizes from storage on initial load - by @userquin in vitest-dev/vitest#7265 (6555d) vite-node: Named export should overwrite export all - by @hi-ogawa in vitest-dev/vitest#7846 (5ba0d) Add ERR_MODULE_NOT_FOUND code error if module cannot be loaded - by @sheremet-va in vitest-dev/vitest#7776 (f9eac) 🏎 Performance browser: Improve browser parallelisation - by @sheremet-va in vitest-dev/vitest#7665 (816a5)
Description
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.